package com.vinjogames.som.entities;

import com.vinjogames.som.util.collision.CollisionChecker;

import android.graphics.PointF;

public class Character {
	protected int health;
	protected int level;
	protected int experience;
	protected float moveSpeed = 1f;
	long lastUpdate;
	
	protected PointF location;
	
	public void moveLeft(long t) {
		if(CollisionChecker.getInstance().attemptMoveLeft(this, t)) {
			location.x = location.x - (moveSpeed * (float)t / 1000.0f);
		}
	}
	
	public void moveUp(long t) {
		if(CollisionChecker.getInstance().attemptMoveUp(this, t)) {
			location.y = location.y + (moveSpeed * (float)t / 1000.0f);
		}
	}
	
	public void moveRight(long t) {
		if(CollisionChecker.getInstance().attemptMoveRight(this, t)) {
			location.x = location.x + (moveSpeed * (float)t / 1000.0f);
		}
	}
	
	public void moveDown(long t) {
		if(CollisionChecker.getInstance().attemptMoveDown(this, t)) {
			location.y = location.y - (moveSpeed * (float)t / 1000.0f);
		}
	}
	
	public PointF getLocation() { return location; }
	public void setLocation(float x, float y) { location.set(x,y); }
}
